/*************************************************************************
	> File Name: stiching_picture.cpp
	> Author: 
	> Mail: 
	> Created Time: 2021年05月17日 星期一 17时26分21秒
 ************************************************************************/

/*找两张图片（如苹果和梨），第一张图片的左边与第二张图的右边合成一张图*/

#include <opencv2/opencv.hpp>
#include <iostream>
#include <cstdio>

using namespace cv;
using namespace std;


int main() {
    Mat appleImage = imread("../data/apple.jpg");
    Mat pearImage = imread("../data/pear.jpg");

    //cout << "appleImage:" << appleImage << endl;
    //cout << "pearImage:" << pearImage << endl;
    
    Mat srcImage;
    resize(appleImage, appleImage, Size(pearImage.cols, pearImage.rows));

    printf("Begin to cut:\n");
    Mat appleTest = appleImage(Range(0, appleImage.rows), Range(0, (int)appleImage.cols / 2 + 1));
    //imshow("Apple cut pic", appleTest);
    Mat pearTest = pearImage(Range(0, pearImage.rows), Range((int)pearImage.cols / 2 + 1, pearImage.cols));
    printf("OVER\n");

    int height = pearImage.rows;
    int width = pearImage.cols;

    Mat dest;
    hconcat(appleTest, pearTest, dest);


    imwrite("destImage.jpg", dest);
    //imwrite("destImage.jpg", destImage);

    //imshow("Combined Picture", destImage);
    imshow("Combined Picture", dest);

    waitKey(0);

    return 0;
}



